// 1.
let num = 1234567.89;  
let formattedNum = num.toLocaleString();  
console.log(formattedNum);

// 2.
const formatter = new Intl.NumberFormat('en-US');
console.log(formatter.format(1234567.89));